package base;

import java.util.Scanner;

/*
 * 求整数2+22+222+2222+22222+...
 * 
 * */
public class sum {
	public static void main(String[] args) {

	   Scanner sc =new Scanner(System.in);
	   System.out.println("请输入第一个数为需要加的整数：");
	   int num1= sc.nextInt();
	   System.out.println("请输入第二个数为需要连加的次数：");
	   int num2 =sc.nextInt()-1;
	   
	   System.out.println("结果为："+sum(num1,num2));
	}

	public static int sum(int num1,int num2){
		int sum=0;
		while(num2>=0){
			sum +=rows(num1,num2);
			num2--;
		}
		return sum;
	}
	
	public static int rows(int num1,int num2){
		int sum =0;
		while(0 <= num2){
		int num3=(int) Math.pow(10, num2);
		sum +=num3*num1;
		num2--;
		}
		return sum;
	}
	
}
